﻿//using System;
//using System.Text;
//using System.Collections.Generic;
//using System.Linq;
//using Microsoft.VisualStudio.TestTools.UnitTesting;
//using mBlog.Data;
//using mBlog.Core.Services;
//using mBlog.Data.Entities;

//namespace mBlog.Test
//{
//    [TestClass]
//    public class CommentServiceTest
//    {
//        [TestMethod]
//        public void CommentAddTest()
//        {
//            mBlogContext blogContext = new mBlogContext();

//            ICommentService cmtService = new CommentService(
//                    new Repository<Comment>(blogContext),
//                    new Repository<Post>(blogContext)
//                );

//            IPostService pService = new PostService(
//                    new Repository<Post>(blogContext),
//                    new Repository<Category>(blogContext),
//                    new Repository<Tag>(blogContext)
//                );

//            var p = pService.Single(21);
//            int commentCount = p.Comments.Count;
//            mBlog.Core.Models.Comment cmt = new Core.Models.Comment();

//            cmt.Post = p;
//            cmt.IsSpam = false;
//            cmt.Site = "http://fengqijunc.om";
//            cmt.IP = "0.0.0.1";
//            cmt.Author = "derek";
//            cmt.Content = "Comment Service Add Test";
//            cmt.CommentTime = DateTime.Now;
//            cmt.Email = "derek.feng@mkcorp.com";

//            cmtService.Add(cmt);

//            p = pService.Single(21);

//            Assert.AreEqual(commentCount + 1, p.Comments.Count());
//        }

//        [TestMethod]
//        public void CommentUpdateTest()
//        {
//            mBlogContext blogContext = new mBlogContext();

//            ICommentService cmtService = new CommentService(
//                    new Repository<Comment>(blogContext),
//                    new Repository<Post>(blogContext)
//                );

//            var comment = cmtService.Single(4);

//            comment.Content = "Derek updated";

//            cmtService.Update(comment);

//            var newComment = cmtService.Single(4);

//            Assert.AreEqual("Derek updated", newComment.Content);
//        }
//    }


//}
